<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="copyright" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<title>注册第三步</title>
<link href="../favicon.ico" rel="shortcut icon">
<link href="https://cdn.jsdelivr.net/gh/bootcdn/BootCDN/ajax/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<link href="${pageContext.request.contextPath}/css/system/public.css" rel="stylesheet"/>
<link href="${pageContext.request.contextPath}/css/system/register.css" rel="stylesheet"/>
</head>
<body class="s_body k_body">
	<ul class="s_header">
        <li><img src="${pageContext.request.contextPath}/images/system/s_logo.png" /></li>
        <li><a href="http://cecook.cn">首页</a></li>
        <%-- <li><a href="${pageContext.request.contextPath}/ui/home">首页</a></li> --%>
        <li><a href="javascript:;">产品优势</a></li>
        <li><a href="javascript:;">成为代理商</a></li>
        <li><a href="javascript:;">联系我们</a></li>
        <li class="s_header_on"><a href="${pageContext.request.contextPath}/ui/loginPwd">登录</a></li>
        <li><a href="${pageContext.request.contextPath}/ui/registerOne">申请试用</a></li>
    </ul>
	<div class="s_content">
		<h3>
			<span>3</span>
			<p>/4</p>
			为了更多的潜在客户发现你，请发布企业介绍
		</h3>
		<div class="s_login_box">
			<form class="k_login">
				<p>
					<i>企业介绍</i>
					<textarea rows="5" cols="20" placeholder="请输入企业介绍" id="intro"
						maxlength="1000"></textarea>
				</p>
				<p>
					<i>企业业务</i><input type="text" placeholder="多业务请使用“，”分开"
						id="business" maxlength="50"><span>例如：童装，OA，百度推广，机票，旅游等</span>
				</p>
				<p>
					<i style="margin-top: -5px;">营业执照</i>
<%-- 	 				<form action="${pageContext.request.contextPath}/api/company/b_uploadFile" enctype="multipart/form-data" method="post">
					<input type="file" name="file">
 					<input type="submit" value="提交">
					</form> --%> 
					<button class="uploadBtn" >上传
					<input onchange="previewImage(this)" type="file" class="uploadFile" id="uploadFile" name="file"/></button>										
					<a href="javascript:;" class="s_charter" id="s_charter"></a> <a
						href="javascript:;" class="s_delect_btn" id="s_delect_btn">删除</a>
				</p>
			<div id="warning_word" style="color:red;text-align:center;"></div>
			<div class="btnBox">
				<a href="javascript:;" class="s_dl_button">下一步</a>
			</div>

		</div>
	</div>
	<div class="s_footer">
		<p>zhfeat</p>
	</div>
	<!-- 企业营业执照预览 -->
	<div class="s_popup">
		<div class="issues">
			<div id="preview"></div>
			<span><img src="${pageContext.request.contextPath}/images/system/icon_close.png" /></span>
		</div>
	</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/system/upload.js"></script>

<script>
$('.s_charter').click(function() {
	$('.s_popup').show();
	$('.issues').show();
});
$('.issues span').click(function() {
	$('.s_popup').hide();
	$('.issues').hide();
});
$('.k_login input,.k_login textarea').focus(function() {
	$(this).addClass('focus');
});
$('.k_login input,.k_login textarea').blur(function() {
	$(this).removeClass('focus');
});
$(function() {
	$('.issues span').on('click', function() {
		$('.s_popup').hide();
	})
	$('.s_delect_btn').on('click', function() {
		$('#preview').html('');
		$('#s_charter').text("");
		$("#s_delect_btn").hide();
	})
})
</script>
<script type="text/javascript">
//点击下一步，点击事件
var wword = $("#warning_word");
$(function() {
	$('.s_dl_button').click(function() {
		var a=$('#s_charter').text();
		if(a==""||a==null){
			wword.text("营业执照必须上传");
			return;
		}else{
			b_next();
		}				

	});	
});	 	
function b_next(){
	//企业介绍
	var intro = $('#intro').val();
    //企业业务  	    	
	var business = $('#business').val();
	var url = "${pageContext.request.contextPath}/api/company/infoUpdate";
	var params = {"intro" : intro,"business" : business};
	$.ajax({
		type : "POST",
		url : "${pageContext.request.contextPath}/api/company/infoUpdate",
		data : params,
		dataType : "json",
		success : function(data) {
			if ("1" == data.error_code) {
				window.location.href = "${pageContext.request.contextPath}/ui/registerFour";
			} else {
				wword.text(data.message);	
			/* 显示错误 */
		   //error = data.message
			}
		}
	});		
}		
</script>
</body>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.ui.widget.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.fileupload.js"></script>
<script type="text/javascript">
var wword = $("#warning_word");
$(function(){
	$(":file").click(function(){
		$(':file').fileupload({
			url : "${pageContext.request.contextPath}/api/company/b_uploadFile",
			iframe: true,
			formData : {
				typename:"file"
			},
			dataType:"json",
			done : function(e,data) {
				if("0"==data.result.error_code){
					//alert("上传图片失败");
					wword.text(data.result.error_msg);
					$('#s_charter').text("");
					$("#s_delect_btn").hide();
					
				}else{
					wword.text("");
					console.log(data.result.error_msg);
				}
			},

		});
	});
});
</script>
</html>

